package Bug;

import java.io.File;
import java.io.IOException;

/**
 * @author: wh(1835734390 @ qq.com)
 * @date: 2024/6/18 16:12
 * @description:
 * @version:
 */
public class TEST {
    public static void main(String[] args) {
        String directoryPath = "D:\\tmp\\upload";
        // Create a File object
        File directory = new File(directoryPath);
        if (directory.isDirectory()) {
            File tempFile = new File(directory, "test.tmp");
            try {
                if (tempFile.createNewFile()) {
                    System.out.println("文件生成成功");
                } else {
                    System.out.println("文件生成失败");
                }
            } catch (IOException e) {
                System.out.println("文件生成失败：" + e.getMessage());
            } finally {
                tempFile.delete();
            }
        }
    }
}
